package com.dmcliver.timetracker.session;

import com.dmcliver.timetracker.entity.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

@Name("personHome")
public class PersonHome extends EntityHome<Person> {

	public void setPersonPersonid(BigDecimal id) {
		setId(id);
	}

	public BigDecimal getPersonPersonid() {
		return (BigDecimal) getId();
	}

	@Override
	protected Person createInstance() {
		Person person = new Person();
		return person;
	}

	public void load() {
		if (isIdDefined()) {
			wire();
		}
	}

	public void wire() {
		getInstance();
	}

	public boolean isWired() {
		return true;
	}

	public Person getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

	public List<Timeentry> getTimeentries() {
		return getInstance() == null ? null : new ArrayList<Timeentry>(
				getInstance().getTimeentries());
	}

}
